package _15_generics._15_7;

import java.util.ArrayList;
import java.util.List;

/**
 * 编译器可以再编译期间确保类型的正确性
 */
public class _09_FilledListMaker<T> {

    List<T> create(T t,int size){
        List<T> list = new ArrayList<>(size);
        for (int i = 0;i < size; i++){
            list.add(t);
        }
        return list;
    }

    public static void main(String[] args) {
        _09_FilledListMaker<String> filledListMaker = new _09_FilledListMaker<>();
        System.out.println(filledListMaker.create("hello",4));
    }
}
